//
//  CYProjectDetail_PhonePopView.m
//  cyydt
//
//  Created by chu on 2019/1/24.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYProjectDetail_PhonePopView.h"

@implementation CYProjectDetail_PhonePopView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
//        NSArray *nibView =  [[NSBundle mainBundle] loadNibNamed:@"CYProjectDetail_PhonePopView" owner:self options:nil];
//        UIView *backView = [nibView objectAtIndex:0];
//        backView.frame = frame;
//        backView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];
//        [self addSubview:backView];
    }
    return self;
}

- (void)awakeFromNib{
    [super awakeFromNib];
    
    self.backView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
    self.nameView.layer.borderWidth = 1;
    self.nameView.layer.borderColor = RGBOF(0xD2D2D2).CGColor;
    
    self.phoneView.layer.borderWidth = 1;
    self.phoneView.layer.borderColor = RGBOF(0xD2D2D2).CGColor;
    
    self.growingTextView.delegate = self;
    self.growingTextView.font = [UIFont systemFontOfSize:12];
    self.growingTextView.minNumberOfLines = 1;
    self.growingTextView.maxNumberOfLines = 10;
    self.growingTextView.placeholder = @"请输入您要留言的内容";
    self.growingTextView.enablesReturnKeyAutomatically = YES;
    self.growingTextView.minHeight = 63;
    self.growingTextView.maxHeight = 63;
    self.growingTextView.layer.borderWidth = 1;
    self.growingTextView.layer.borderColor = RGBOF(0xD2D2D2).CGColor;
    self.growingTextView.layer.masksToBounds = YES;
    self.growingTextView.contentInset = UIEdgeInsetsMake(5, 15, 5, 15);
}

- (IBAction)tijiaoAction:(UIButton *)sender {
    if (self.block) {
        self.block(self.nameTF.text, self.phoneTF.text, self.growingTextView.text);
//        [self dismiss];
    }
}


- (void)show{
    self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:self];
}

- (IBAction)dismi:(UIButton *)sender {
    [self dismiss];
}

- (void)dismiss{
    [self removeFromSuperview];
}



@end
